package com.example.myapplication02.paging.room;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

@Database(entities = {User.class}, version = 1, exportSchema = false)
public abstract class UserDatabase extends RoomDatabase {
    static volatile UserDatabase instance;
    public static UserDatabase getInstance(Context context) {
        if (instance == null) {
            synchronized (UserDatabase.class) {
                if (instance == null) {
                    instance = Room.databaseBuilder(context, UserDatabase.class, "user_db")
                            .build();
                }
            }
        }
        return instance;
    }

    public abstract UserDao getUserDao();

}
